package com.sxt.common;

/**
 * @Description: 业务结果包装类
 * @author: Mr.T
 * @date 2020-11-03 11:24
 */
public class Result {


    private Integer code;//业务码

    private String msg;// 业务消息

    private Object data;// 业务数据

    /**
     * 成功 但是没有返回数据
     */
    public Result(){
        this.code = CodeMsg.SUCCESS.code;
        this.msg = CodeMsg.SUCCESS.msg;
    }

    /**
     * 成功 有数据
     * @param data
     */
    public Result(Object data){
        this();
        this.data = data;
    }

    /**
     * 失败  失败的原因很多
     *CodeMsg 异常信息枚举对象
     */
    public Result(CodeMsg codeMsg){
        this.code = codeMsg.code;
        this.msg = codeMsg.msg;
    }


    public Result(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
